import 'package:bordered_text/bordered_text.dart';
import 'package:find_friend/const/const.dart';
import 'package:find_friend/pages/xspace/post/xpost_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class SchoolPage extends StatelessWidget {
  static const List<String> schoolName = ["深圳大学","南方科技大学","哈尔滨工业大学","香港中文大学"];
  static const List<String> schoolNameEN = [
    "Shenzhen University",
    "Southern University of Science and Technology",
    "Harbin Institute Of Technology",
    "The Chinese University of Hong Kong"
  ];
  Widget _createSchoolCell(BuildContext context,int index) {
    final size = MediaQuery.of(context).size;
    
    return Flexible(
      flex: 1,
      child: Container(
        width: size.width,
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(5),
          image: DecorationImage(
            image: AssetImage("assets/school$index.png"),
            fit: BoxFit.cover
          ),
          boxShadow: [
            BoxShadow(blurRadius: 10, spreadRadius: -6, color: Colors.black, offset: Offset(1, 1))
          ]
        ),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Text(schoolName[index - 1], style: instanceTextStyle(15, Colors.white),),
            Text(schoolNameEN[index - 1], style: instanceTextStyle(15, Colors.white),),
          ],
        )
      ),
    );
  }
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Colors.white,
        elevation: 0.5,
        flexibleSpace: Container(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.end,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              Row(
                mainAxisAlignment: MainAxisAlignment.center,
                crossAxisAlignment: CrossAxisAlignment.end,
                children: [
                  BorderedText(
                    strokeWidth: 1.0,
                    strokeColor: Colors.black,
                    child: Text(
                      's',
                      style: TextStyle(
                        color: const Color(0xffFFD33A),
                        fontSize: 21.0,
                        fontFamily: "AlegreyaSansSC",
                        fontStyle: FontStyle.italic
                      ),
                    ),
                  ),
                  Padding(
                    padding: const EdgeInsets.only(bottom: 2.0),
                    child: BorderedText(
                      strokeWidth: 1.0,
                      strokeColor: Colors.black,
                      child: Text(
                        'HE',
                        style: TextStyle(
                          color: Colors.black,
                          fontSize: 13.0,
                          fontFamily: "AlegreyaSansSC",
                          fontStyle: FontStyle.italic
                        ),
                      ),
                    ),
                  ),
                ],
              ),
              Padding(
                padding: const EdgeInsets.only(bottom:8.0),
                child: Text("I will be with you", style: TextStyle(fontFamily: "snell", fontSize: 14, color: Colors.black),),
              ),
            ],
          ),
        ),
        actions: [
          InkWell(
            onTap: () => Navigator.pushNamed(context, '/search'),
            child: Image.asset("assets/sousuo.png", width: 30,color: Colors.black,)
          ),
          InkWell(
            onTap: (){
              push(context, XPostPage());
            },
            child: Image.asset("assets/fabu2.png", width: 30,),
          )
        ],
      ),
      body: SafeArea(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          children: [
            SizedBox(height: 10,),
            _createSchoolCell(context, 1),
            SizedBox(height: 10,),
            _createSchoolCell(context, 2),
            SizedBox(height: 10,),
            _createSchoolCell(context, 3),
            SizedBox(height: 10,),
            _createSchoolCell(context, 4),
          ],
        ),
      )
    );
  }
}